#ifndef _REMOTE_H_
#define _REMOTE_H_

#include "libusb.h"
#include "types.h"

typedef struct {
	uint8_t request;
	uint8_t addrLsb;
	uint8_t addrMsb;
	uint8_t mark;
	uint8_t value0;
	uint8_t datlen;
	uint8_t data[26];
} prx_package_t;

typedef enum {
	PRX_IO8_BIT = 0,
	PRX_IO8_RW,
	PRX_MEM8_BIT,
	PRX_MEM8_RW,
	PRX_RF_BIT,
	PRX_RF_RW,
	PRX_WFLASH,
	PRX_RFLASH,
	PRX_RESET,
	PRX_ECHO,
} prx_request_t;

int writeRadioPackage(
	libusb_device_handle * dev,
	prx_request_t request, 
	int addr, 
	int mark, 
	int value0, 
	char *data, 
	int data_len,
	char *rspbuf,
	int *rsp_size );
int radioPing(libusb_device_handle *dev);
int radioIO8Bit(libusb_device_handle *dev, int reg_addr, int pinMask, int act);
int radioIO8RW(libusb_device_handle *dev, int reg_addr, int reg_value, int is_write);
int radioConfigIO(libusb_device_handle *usb_dev, const char *strPort, int index, char *t);
int radioSetIO(libusb_device_handle *dev, const char *strPort, int index, int act);
int radioGetIO(libusb_device_handle *dev, const char *strPort, int index);
int radioRFRegRW(libusb_device_handle *dev, int address, int value, int act);
int radioRFRegBit(libusb_device_handle *dev, int address, int index, int act);
int radioReset(libusb_device_handle *dev);
int str2McuGpioType(const char *c);
int str2McuGpioAddr(const char *c, int *portRegAddr, int *pinRegAddr, int *ddrRegAddr);
unsigned long getTickCount(void);

#endif
